(function () {
    // console.log($('.info'))
    let info = document.querySelector('.info')
    info.addEventListener('click', function (e) {
        // console.log(e.target.parentNode.parentNode.parentNode.nodeName)

        let li = e.target.parentNode.parentNode.parentNode
        let id = li.getAttribute('productId')
        console.log(id)
        location.href = '../pages/Particulars.html?productId=' + id


    })



    $.ajax({
        url: 'http://chst.vip:1234/api/getmoneyctrl',
        success(res) {
            // console.log(res.result)
            let str = ''
            let regExp = /(?<=imgurl=)[^'"]*/
            res.result.forEach(item => {
                // console.log(item)
                str += `
                <li productId=${item.productId}>
                <a href="javascript:;" productId=${item.productId}>
                <div class="pic">
                <img src=${item.productImg2.match(regExp)}>
                    </div>
                    <div class="infoText">
                        <div class="infoText_Top">
                            ${item.productName} 
                            <span class="red">${item.productPinkage}</span>
                        </div>
                        <div class="infoText_Bottom">
                            <span class="info_Left">
                                ${item.productFrom} | ${item.productTime}
                            </span>
                            <span class="info_Right">
                                <span class="iconfont icon-xinxi"></span>
                                ${item.productComCount}
                            </span>
                        </div>
                    </div>
                </a>
            </li>

                `
            })
            $('.info').html(str)
        }
    })

    // 更多折叠效果
    let flag = true
    $('.more_flod').click(function () {
        // console.log(1)
        if (flag) {
            $('#nav').css({
                height: "5.3333rem"
            })
            flag = false
        } else {
            // console.log(2)
            $('#nav').css({
                height:"8rem"
            })
            flag = true
        }
    })


})()